package com.xuemeng.task;


import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Lookup;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;


/**
 * 定时任务类模型
 *
 * @author xuemeng
 * @date 2018/12/13 10:02
 */

//@Component
public class ScheduledService {
        //定义一个全局的记录器，通过LoggerFactory获取
        private final static Logger logger = LoggerFactory.getLogger(ScheduledService.class);

        //@Scheduled(cron = "0/5 * * * * *")
        public void scheduled() {
                logger.debug("=====>>>>>使用cron  {}", System.currentTimeMillis());
        }

        // @Scheduled(fixedRate = 5000)
        public void scheduled1() {
                logger.debug("=====>>>>>使用fixedRate{}", System.currentTimeMillis());
        }

        // @Scheduled(fixedDelay = 5000)
        public void scheduled2() {
                logger.debug("=====>>>>>fixedDelay{}", System.currentTimeMillis());
        }

}
